package com.lenovo.nova.widget.dialog.buildview;

import android.app.Activity;
import android.app.Dialog;
import android.app.DialogFragment;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;

import android.widget.TextView;
import com.lenovo.nova.utils.R;
import com.lenovo.nova.widget.dialog.BaseDialogFragment;

public class DefaultViewBuild implements DialogFragmentBuilder {

	BaseDialogFragment baseDialog;
    private TextView mMessage;
    private CharSequence msg;

    public DefaultViewBuild(BaseDialogFragment baseDialg) {
		this.baseDialog = baseDialg;
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {

	}

	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {
		Dialog dialog = new Dialog(baseDialog.getActivity(), baseDialog.getTheme()) {
			@Override
			protected void onCreate(Bundle savedInstanceState) {
				super.onCreate(savedInstanceState);
				// getView().getViewTreeObserver().addOnPreDrawListener(new
				// OnPreDrawListener() {
				// @Override
				// public boolean onPreDraw() {
				// return false;
				// }
				// });

			}

			@Override
			public void onAttachedToWindow() {
				super.onAttachedToWindow();
			}
		};


		return dialog;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		FrameLayout layout = new FrameLayout(baseDialog.getActivity());
		layout.setBackgroundResource(R.drawable.png_dialog_bg);
        mMessage = new TextView(baseDialog.getActivity());
        layout.addView(mMessage);
		return layout;
	}

	@Override
	public void onAttach(Activity activity) {
	}

	@Override
	public void onDetach() {
	}

	@Override
	public void setView(View v) {

	}

	@Override
	public void setButton(int which, CharSequence msg, OnClickListener l) {
		
	}

	@Override
	public void setTitle(CharSequence msg) {
		this.msg = msg;
	}

	@Override
	public void setMessage(CharSequence message) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {

	}


}